#include <iostream>
#include <ctemplate/template.h>

int main()
{
    std::string in_html = "Test_ctemplate.html";
    std::string key1 = "I LOVE YOU";
    std::string key2 = "我爱你";
    std::string key3 = "1314520";

    // 形成数据字典
    ctemplate::TemplateDictionary dict("Test_ctemplate");
    dict.SetValue("key1",key1);
    dict.SetValue("key2",key2);
    dict.SetValue("key3",key3);

    // 获取被渲染网页对象
    // DO_NOT_STRIP：保持html网页原貌
    ctemplate::Template* tpl = ctemplate::Template::GetTemplate(in_html,ctemplate::DO_NOT_STRIP);

    // 添加数据字典到网页中
    std::string out_html;
    tpl->Expand(&out_html,&dict);

    // 完成渲染
    std::cout << out_html << std::endl;

    return 0;
}